package codename.carrot.bomberman.game.gamemessages;

/**
 *  A networkmessage representing the movement of a player
 * @author Group A4
 *
 */
public class PlayerMovementMessage extends BombermanMessage {
	/**
	* UID for serialization.
	 */
    private static final long serialVersionUID = 1L;
	/**
	 * The x-coordinate from where the player is/or was.
	 */
    private int xMapCoor,  
	/**
	 * The y-coordinate from where the player is/or was.
	 */
    yMapCoor;
	/**
	 * The direction of movement.
	 */
    private int direction;
	/**
	 * True if the player is moving.
	 */
    private boolean moving;
    
    /**
     * Constructs a player movement message.
     * @param playerId The moving player id.
     * @param xMapCoor The x-coordinate from/to.
     * @param yMapCoor The y-coordinate from/to.
     * @param direction The direction the player is moving.
     * @param isMoving True if the player is moving (coordinates are set to from), False if the
     * player is not moving (coordinates are set to to).
     */
    public PlayerMovementMessage(int playerId, int xMapCoor, int yMapCoor, int direction, boolean isMoving) {
        setPlayerId(playerId);
        this.xMapCoor = xMapCoor;
        this.yMapCoor = yMapCoor;
        this.direction = direction;
        this.moving = isMoving;
    }       
        
    /**
     * Constructs a player movement message with a player id.
     * @param playerId The moving player id.
     */
    public PlayerMovementMessage(int playerId) {
        setPlayerId(playerId);
    }

    /**
     * Returns the x-coordinate from which the player moved from, if <code>isMoving</code>
     * @return The x-coordinate.
     */
    public int getxMapCoor() {
        return xMapCoor;
    }    

    /**
     * Returns the y-coordinate from which the player moved from, if <code>isMoving</code>
     * @return The y-coordinate.
     */
    public int getyMapCoor() {
        return yMapCoor;
    }

    /**
     * The direction the player is moving.
     * @return The direction of movement.
     */
    public int getDirection() {
        return direction;
    }

    /**
     * True if the player is moving, false otherwise.
     * @return True if the player is moving, false otherwise.
     */
    public boolean isMoving() {
        return moving;
    }                    
}
